--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 7368cf766e023acac34546aeb126bf4d4c153726
Parents : a74e0f9
Author : Mark Qvist <mark@unsigned.io>
Date : 2022-10-02T12:45:06+02:00
Settings reload for split ui/service
Changes
4 files changed, 27 insertions(+), 7 deletions(-)
Diff
diff --git a/sbapp/services/sidebandservice.py b/sbapp/services/sidebandservice.py
index 6638365a..e30af4aa 100644
--- a/sbapp/services/sidebandservice.py
+++ b/sbapp/services/sidebandservice.py
@@ -162,6 +162,10 @@ class SidebandService():
if self.notification_service != None:
self.notification_service.cancelAll()
+ if self.sideband.getstate("wants.settings_reload"):
+ self.sideband.setstate("wants.settings_reload", False)
+ self.sideband.reload_configuration()
+
time.sleep(sleep_time)
self.release_locks()
diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py
index 16338bad..f1185365 100644
--- a/sbapp/sideband/core.py
+++ b/sbapp/sideband/core.py
@@ -191,10 +191,10 @@ class SidebandCore():
self.save_configuration()
def __load_config(self):
- RNS.log("Loading Sideband identity...")
+ RNS.log("Loading Sideband identity...", RNS.LOG_DEBUG)
self.identity = RNS.Identity.from_file(self.identity_path)
- RNS.log("Loading Sideband configuration... "+str(self.config_path))
+ RNS.log("Loading Sideband configuration... "+str(self.config_path), RNS.LOG_DEBUG)
config_file = open(self.config_path, "rb")
self.config = msgpack.unpackb(config_file.read())
config_file.close()
@@ -206,15 +206,27 @@ class SidebandCore():
self._db_initpersistent()
+ def __reload_config(self):
+ RNS.log("Reloading Sideband configuration... "+str(self.config_path), RNS.LOG_DEBUG)
+ config_file = open(self.config_path, "rb")
+ self.config = msgpack.unpackb(config_file.read())
+ config_file.close()
+
+ self.update_active_lxmf_propagation_node()
+
def __save_config(self):
- RNS.log("Saving Sideband configuration...")
+ RNS.log("Saving Sideband configuration...", RNS.LOG_DEBUG)
config_file = open(self.config_path, "wb")
config_file.write(msgpack.packb(self.config))
config_file.close()
-
+ if self.is_client:
+ self.setstate("wants.settings_reload", True)
+
+ def reload_configuration(self):
+ self.__reload_config()
+
def save_configuration(self):
- RNS.log("Saving configuration")
self.__save_config()
def set_active_propagation_node(self, dest):
@@ -1009,6 +1021,9 @@ class SidebandCore():
self.rns_dir = RNS.Reticulum.configdir
+ self.update_active_lxmf_propagation_node()
+
+ def update_active_lxmf_propagation_node(self):
if self.config["lxmf_propagation_node"] != None and self.config["lxmf_propagation_node"] != "":
self.set_active_propagation_node(self.config["lxmf_propagation_node"])
else:
diff --git a/sbapp/ui/conversations.py b/sbapp/ui/conversations.py
index 30a4c942..6d1815f0 100644
--- a/sbapp/ui/conversations.py
+++ b/sbapp/ui/conversations.py
@@ -74,10 +74,11 @@ class Conversations():
else:
trust_icon = "account-question"
- iconl = IconLeftWidget(icon=trust_icon)
+ iconl = IconLeftWidget(icon=trust_icon, on_release=self.app.conversation_action)
item = OneLineAvatarIconListItem(text=self.app.sideband.peer_display_name(context_dest), on_release=self.app.conversation_action)
item.add_widget(iconl)
item.sb_uid = context_dest
+ iconl.sb_uid = context_dest
def gen_edit(dest, item):
def x():
diff --git a/sbapp/ui/layouts.py b/sbapp/ui/layouts.py
index e6aaf785..e12f1b39 100644
--- a/sbapp/ui/layouts.py
+++ b/sbapp/ui/layouts.py
@@ -677,7 +677,7 @@ MDNavigationLayout:
height: dp(48)
MDLabel:
- text: "Deliver via LXMF Propagation Node by default"
+ text: "Send via Propagation Node by default"
font_style: "H6"
MDSwitch:
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────